package learning.socket2;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Calculate {
	public static void main(String[] args) {
		ServerSocket ss = null;
		try {
			ss = new ServerSocket(2222);
			Socket s = ss.accept();
			DataInputStream dis = new DataInputStream(s.getInputStream());
			DataOutputStream dos = new DataOutputStream(s.getOutputStream());
			int a = dis.readInt();
			int b = dis.readInt();
			int c = dis.readInt();
			double area = area(a, b, c);
			
				dos.writeDouble(area);
				dos.flush();
			
			dis.close();
			dos.close();
			s.close();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	private static double area(int a, int b, int c) {
		if ((a + b) > c && (a + c) > b && (b + c) > a) {
			double p = (a + b + c) / 2.0;
			return Math.sqrt(p * (p - a) * (p - b) * (p - c));
		}
		return 0;
	}
}
